package com.bw.z.mvp.model;

import com.bw.z.mvp.model.entity.BaseEntity;
import com.bw.z.mvp.base.model.BaseModel;
import com.bw.z.mvp.contract.RegisterContract;
import com.bw.z.mvp.model.entity.RegisterEntity;
import com.bw.z.network.Api;
import com.bw.z.network.ChangeFunction;
import com.bw.z.network.HttpFactory;
import com.bw.z.network.HttpType;

import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;

public class RegisterModel extends BaseModel implements RegisterContract.registerModel {

    @Inject
    public RegisterModel() {
    }

    @Override
    public Observable<BaseEntity> requestRegister(Map<String, Object> map) {
        Observable<RegisterEntity> ob = HttpFactory.getInstance().factory(HttpType.TOKENSIGNTYPE)
                .getRetrofit()
                .create(Api.class)
                .requestRegister(createBody(map));
        return ob.map(new ChangeFunction<RegisterEntity>());
    }
}
